//
//  LiverAbnormalEchoViewController.m
//  yilutongxing
//
//  Created by T&J on 2017/6/26.
//  Copyright © 2017年 YZE. All rights reserved.
//

#import "LiverAbnormalEchoViewController.h"

@interface LiverAbnormalEchoViewController ()
@property (strong, nonatomic) IBOutlet UITextField *lCountTextfield;
@property (strong, nonatomic) IBOutlet UITextField *lSizeTextfield;
@property (strong, nonatomic) IBOutlet UITextField *hCountTextfield;
@property (strong, nonatomic) IBOutlet UITextField *hSizeTextfield;
@end

@implementation LiverAbnormalEchoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"肝脏异常回声光团";
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navigationbarBackGroundImage"]
                                                  forBarMetrics:UIBarMetricsDefault];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"保存"
                                                                             style:UIBarButtonItemStyleDone
                                                                            target:self
                                                                            action:@selector(saveAction)];
    UIImage *img = [[UIImage imageNamed:@"返回"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:img
                                                                            style:UIBarButtonItemStyleDone
                                                                           target:self
                                                                           action:@selector(backAction)];
    if (_model) {
        _lCountTextfield.text = _model.lCount;
        _lSizeTextfield.text = _model.lSize;
        _hCountTextfield.text = _model.hCount;
        _hSizeTextfield.text = _model.hSize;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - 事件响应
- (void)backAction{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)saveAction{
        _model.lCount = _lCountTextfield.text;
        _model.lSize = _lSizeTextfield.text;
        _model.hCount = _hCountTextfield.text;
        _model.hSize = _hSizeTextfield.text;
        
        if ([self.delegate respondsToSelector:@selector(backLiverAbnormalEcho:)]) {
            [self.delegate backLiverAbnormalEcho:_model];
        }
        
        [self backAction];
}

#pragma mark - Table view data source

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 10;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.01;
}

@end
